package com.econ.powercloud.ems.common.enums;

import java.util.Arrays;
import java.util.List;

/**
 * 并离网操作记录状态枚举
 * @author jwc
 * @date 2022/08/09
 */
public enum GridRecordStatusEnum implements EnumMethod{
    NOT_STARTED (1,"未开始"),
    IN_PROGRESS(2,"进行中"),
    SUCCESS(3,"成功"),
    FAIL(4,"失败"),
    TERMINATED(5,"已终止"),
    UNCONFIRMED(6,"待确认成功");

    private Integer code;
    private String desc;


    GridRecordStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    public static String fromCode(Integer code) {
        for (GridRecordStatusEnum obj : GridRecordStatusEnum.values()) {
            if (code.equals(obj.getCode())) {
                return obj.getDesc();
            }
        }
        return null;
    }

    public static List<GridRecordStatusEnum> getRunningState(){
        return Arrays.asList(IN_PROGRESS);
    }

}
